import { Button,DatePicker,Radio } from 'antd';
import React, { useState, useEffect } from 'react';
import { PageContainer } from '@ant-design/pro-layout';
import type { ProColumns } from '@ant-design/pro-table';
import ProTable from '@ant-design/pro-table';
import StatisticsCard from '@/components/StatisticsCard/Index';
import './style.less'
import BreadcrumbDept from '@/components/BreadcrumbDept';
import { ProFormFieldSet } from '@ant-design/pro-form';

const Index: React.FC = () => {
 
  const columns: ProColumns<STOCKGOODSAPI.GoodsItem>[] = [
    {
      title: '统计周期',
      dataIndex: '',
      hideInTable: true,
      renderFormItem: (_, { type, defaultRender, ...rest },form) => {
        if (type === 'form') {
          return null;
        }
        return (<ProFormFieldSet style={{gap: 2}}>
            <DatePicker style={{width: '100%'}} />
              <span style={{padding: '0 5px'}}>-</span>
            <DatePicker style={{width: '100%'}} />
          </ProFormFieldSet>
        );
      }
    },
    {
      title: '护工编号',
      dataIndex: 'class_id',
    },
    {
      title: '护工姓名',
      dataIndex: 'brand_id'
    },
    {
      title: '统计方式',
      dataIndex: 'class_id',
      hideInTable: true,
      valueType: 'radio',
      renderFormItem: () => {
        return <Radio.Group options={[
          {
            label: '按服务周期统计',
            value: 0
          },
          {
            label: '按结算周期统计',
            value: 1
          }
        ]}>

        </Radio.Group>;
      }
    },
    {
      title: '服务单数',
      dataIndex: 'goods_id',
      search: false
    },
    {
      title: '服务患者数',
      dataIndex: 'goods_name',
      search: false
    },
    {
      title: '核算天数',
      dataIndex: 'brand_name',
      search: false
    },
    {
      title: '计费标准（天）',
      dataIndex: 'goods_name',
      search: false
    },
    {
      title: '管理费',
      dataIndex: 'specs_num',
      search: false
    },
    {
      title: '操作',
      valueType: 'option',
      render: (_, record) => [
        <a key="detail" onClick={() => {
         
        }}>详情</a>
      ]
    }
  ];

  return (
    <PageContainer extra={[
      <BreadcrumbDept />
     ]} breadcrumb={{}}>
      <ProTable<STOCKGOODSAPI.GoodsItem, STOCKGOODSAPI.GoodsItem & COMMON.PageParams>
        className="custome-table"
        rowKey="goods_id"
        bordered
        search={{
          span: 8,
          collapsed: false,
          collapseRender: () => '',
          optionRender: (searchConfig, formProps, dom) => {
            dom.shift();
            return [
              ...dom,
              <Button key="export" type="primary">导出报表</Button>
            ]
          }
        }}
        request={async (params) => {
          return {
            data: [],
            success: true,
            total: 0
          };
        }}
        columns={columns}
        scroll={{ x : 1000 }}
        options={false}
        tableExtraRender={(_, data) => (
          <div>
            <div style={{marginBottom: 20, display: 'flex', justifyContent: 'space-between', alignItems: 'center'}}>
              <StatisticsCard iconType="database" title="总服务单数" number={200}/>
              <StatisticsCard title="总服务患者数" iconType="database" number="50000.00"/>
              <StatisticsCard title="服务费汇总" number={5}/>
              <StatisticsCard style={{marginRight: 0}} title="管理费汇总" number="￥1230.00"/>
            </div>
          </div>
        )}
      />
    </PageContainer>
  );
};
export default Index;
